import { createApp } from 'vue'
import App from './App.vue'
import {setupStore} from "./store";
import router ,{setupRouter} from "./router/index.js";
import VueClickAway from "vue3-click-away";
import "@/assets/index.css"
import taoke from "./components/taoke/index.vue"
import importplugin from "./plugins"
import 'virtual:windi.css'

async function kaishi(){
    const appProvider = createApp(taoke);

    const app = createApp(App);

    // 挂载状态管理
    setupStore(app);
    // 导入插件配置等
    importplugin(app)

    //优先挂载一下 Provider 解决路由守卫，Axios中可使用，Dialog，Message 等之类组件
    appProvider.mount('#appProvider', true);

    // 挂载路由
    await setupRouter(app);
    // 路由准备就绪后挂载APP实例
    await router.isReady();
    // 挂载主要组件
    app.mount('#app', true);
}

void kaishi()
